/*
 * Copyright 2007 MBARI
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.mbari.vcr;

//import javax.comm.NoSuchPortException;
//import javax.comm.PortInUseException;
//import javax.comm.SerialPortEvent;
//import javax.comm.SerialPortEventListener;
//import javax.comm.UnsupportedCommOperationException;


/**
 * Class description
 *
 *
 * @version    $Id: $
 * @author     Brian Schlining    
 */
public class VCRTestJavaComm2 extends VCRTestJavaComm1 {

//  public VCRTestJavaComm2(String serialPortName) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException {
//          super(serialPortName);
//          // TODO Auto-generated constructor stub
//  }
//  
//  public VCRTestJavaComm2(String serialPortName, long receiveTimeout) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException {
//          super(serialPortName, receiveTimeout);
//  }
//  
//  void init(String serialPortName) throws NoSuchPortException, PortInUseException, UnsupportedCommOperationException, IOException {
//          super.init(serialPortName);
//          try {
//                  serialPort.addEventListener(new SerialPortEventListener() {
//
//                          public void serialEvent(SerialPortEvent evt) {
//                                  
//                                  switch (evt.getEventType()) {
//
//                                  case SerialPortEvent.BI:
//
//                                  case SerialPortEvent.OE:
//
//                                  case SerialPortEvent.FE:
//
//                                  case SerialPortEvent.PE:
//
//                                  case SerialPortEvent.CD:
//
//                                  case SerialPortEvent.CTS:
//
//                                  case SerialPortEvent.DSR:
//
//                                  case SerialPortEvent.RI:
//
//                                  case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
//                                      break;
//
//                                  case SerialPortEvent.DATA_AVAILABLE:
//                                      byte[] readBuffer = new byte[20];
//
//                                      try {
//                                          while (in.available() > 0) {
//                                              int numBytes = in.read(readBuffer);
//                                              System.out.print(new String(readBuffer));
//                                          } 
//
//                                          
//                                      } catch (IOException e) {}
//
//                                      break;
//                                  }
//                                  
//                          }
//                          
//                  });
//          } catch (Exception e) {
//                  // TODO Auto-generated catch block
//                  e.printStackTrace();
//          }
//  }
//  
//  public static void main(String[] args) {
//          int ok = 0;
//          try {
//                  VCRTestJavaComm2 test = new VCRTestJavaComm2("COM2", 500);
//                  test.send(VCR.GET_STATUS);
//                  test.send(VCR.GET_TIMECODE);
//                  test.send(VCR.PLAY_FWD);
//                  test.send(VCR.GET_STATUS);
//                  test.send(VCR.GET_TIMECODE);
//                  Thread.sleep(2000);
//                  test.send(VCR.STOP);
//                  test.send(VCR.GET_TIMECODE);
//                  Thread.sleep(2000);
//                  test.send(VCR.GET_TIMECODE1);
//                  Thread.sleep(2000);
//                  test.send(VCR.GET_TIMECODE2);
//                  Thread.sleep(2000);
//                  test.send(VCR.GET_STATUS);
//                  Thread.sleep(2000);
//          } catch (Exception e) {
//                  // TODO Auto-generated catch block
//                  e.printStackTrace();
//                  ok = -1;
//          } 
//          
//          System.exit(ok);
//  }

}
